package com.cloudlinkscm.base.authcenter;

import com.cloudlinkscm.base.authcenter.model.dto.*;
import com.cloudlinkscm.base.authcenter.service.AuthcRemoteService;
import com.cloudlinkscm.loms.framework.core.pojo.RestfulApiResponse;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * Created by sin on 2017/7/31.
 */
@FeignClient(name = "auth-center-provider", path = AuthcRemoteService.PATH, fallback = AuthcClient.HystrixClient.class)
public interface AuthcClient extends AuthcRemoteService {

	@Component
	class HystrixClient implements AuthcClient {

		@Override
		public RestfulApiResponse<AccessToken> authenticate(AuthenticationInfo info) {
			return RestfulApiResponse.error("hystrix", "2");
		}

		@Override
		public RestfulApiResponse<AuthenticationWebInfo> authenticateWeb(AuthenticationInfo info) {
			return RestfulApiResponse.error("hystrix", "2");
		}

		@Override
		public RestfulApiResponse<UserAccountDTO> account(String token) {
			return RestfulApiResponse.error("hystrix", "2");
		}

		@Override
		public RestfulApiResponse<List<ResourceTree>> accountResource(String token) {
			return RestfulApiResponse.error("hystrix", "2");
		}
	}
}
